import { observable, computed, action, reaction } from 'mobx';

const PropTypes = require('prop-types');

export default class coinsStore {
  // 货币名
  @observable coins = 'DC';
  // 客户端名
  @observable coinsMiner = 'DCC Miner';
  // 是否为正式版：'Final'  'Beta'
  @observable isStable = 'Final';
  // 版本号
  @observable version = '1.0.0';
  // 年份
  @observable year = '- 2018';
  // 当前用户权限
  @observable permission = 0;

  @observable ajaxURL = 'http://202.59.250.132/18_3_6-ggc/index.php/'

  @observable copyright = ' © 2017-2018 WenDao'

  constructor(permission) {
    // Set the Initial State of Language Observable
    if (permission == null) {
      this.permission = 0;
    }
  }

  @computed get currentCoins() {
    return this.coins;
  }

  @computed get currentCoinsMiner() {
    return this.coinsMiner;
  }

  @computed get currentIsStable() {
    return this.isStable;
  }

  @computed get currentVersion() {
    return this.version;
  }

  @computed get currentYear() {
    return this.year;
  }

  @computed get currentPermission() {
    return this.permission;
  }

  @computed get currentAjaxURL() {
    return this.ajaxURL;
  }

  @computed get currentCopyright() {
    return this.copyright;
  }

  @action('Change Permission To')
  changePermissionTo(permissionCode) {
    this.permission = permissionCode;
    // this.permission = 3;
    console.log(`在store里面改变了权限码，并且权限码为：${this.permission}`);
  }
}
